<template>
	<view>
		<cu-custom :bgLinerBorder="true" :isBlack="false">
			<block slot="content">餐厅接单记录</block>
		</cu-custom>
		<view class="p-l-15 p-r-15 p-t-5 p-b-20">
			<view class="restaurant-item" v-for="(item,index) in list" :key="index" @click="toDetail(item)">
				<view class="flex align-center">
					<image :src="item.cover?item.cover.split(',')[0]:''" class="restaurant-img"></image>
				</view>
				<view class="p-l-15 p-r-15">
					<view class="restaurant-desc fontBold">
						<view class="orange f-16">
							{{item.name}}
						</view>
						<view class="f-12 m-t-5 width100">
							<view v-html="item.describe" class="text-overflow-1"></view>
						</view>
						<view class="f-12 m-t-5 flex width100">
							简介：<view v-html="item.introduce" class="text-overflow-1"></view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="nodata" v-if="list.length == 0">
			暂无数据~
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:1,
				last_page:1,
			}
		},
		onLoad(option) {
			this.getIndex();
		},
		onReachBottom(){
			if(this.page >= this.last_page)return;
			this.page++;
			this.getIndex();
		},
		methods: {
			toDetail(item){
				uni.navigateTo({
					url:'/pages/other/customerList?id='+item.id
				})
			},
			getIndex(){
				let data = {
					page:this.page
				}
				this.$http('/apimanager/shop_manager/shopList',data).then(res=>{
					if(res.code == 200){
						let datas = res.data;
						let list = datas.list.data;
						this.last_page = datas.list.last_page;
						if(this.page == 1){
							
							this.list = list;
						}else{
							this.list = this.list.concat(list);
						}
						
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.restaurant-item{
		margin-top: 30rpx;
		.restaurant-img{
			width: 100%;
			height: 500rpx;
			border-radius: 20rpx;
		}
		.restaurant-desc{
			background: rgba(255,255,255,0.9);
			box-shadow: 0px 0px 16px rgba(0,0,0,0.05);
			border-radius: 16rpx;
			padding: 20rpx 30rpx;
			margin-top: -110rpx;
			position: relative;
			z-index: 2;
		}
	}
</style>
